diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 10:03:40 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 10:03:40 +0300 |
| commit | 8589a3bc97190c3d3bbb7246ea517e7855abfeed (patch) | |
| tree | 7c92af8a6a72148973af1e0ec240a15f2386edea /src/pages/[...blog] | |
| parent | d571a3720ae42f3cf5fddf2454e04aa2ad775b0c (diff) | |
cleanup and styling
Diffstat (limited to 'src/pages/[...blog]')
| -rw-r--r-- | src/pages/[...blog]/[...page].astro | 52 | ||||
| -rw-r--r-- | src/pages/[...blog]/[category]/[...page].astro | 37 | ||||
| -rw-r--r-- | src/pages/[...blog]/[tag]/[...page].astro | 37 | ||||
| -rw-r--r-- | src/pages/[...blog]/index.astro | 54 |
4 files changed, 0 insertions, 180 deletions
diff --git a/src/pages/[...blog]/[...page].astro b/src/pages/[...blog]/[...page].astro deleted file mode 100644 index 5a6da41..0000000 --- a/src/pages/[...blog]/[...page].astro +++ /dev/null @@ -1,52 +0,0 @@ ---- -import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; - -import Layout from '~/layouts/PageLayout.astro'; -import BlogList from '~/components/blog/List.astro'; -import Headline from '~/components/blog/Headline.astro'; -import Pagination from '~/components/blog/Pagination.astro'; -// import PostTags from "~/components/blog/Tags.astro"; - -import { blogListRobots, getStaticPathsBlogList } from '~/utils/blog'; - -export const prerender = true; - -export const getStaticPaths = (async ({ paginate }) => { - return await getStaticPathsBlogList({ paginate }); -}) satisfies GetStaticPaths; - -type Props = InferGetStaticPropsType<typeof getStaticPaths>; - -const { page } = Astro.props as Props; -const currentPage = page.currentPage ?? 1; - -// const allCategories = await findCategories(); -// const allTags = await findTags(); - -const metadata = { - title: `Blog${currentPage > 1 ? ` — Page ${currentPage}` : ''}`, - robots: { - index: blogListRobots?.index && currentPage === 1, - follow: blogListRobots?.follow, - }, - openGraph: { - type: 'blog', - }, -}; ---- - -<Layout metadata={metadata}> - <section class="px-6 sm:px-6 py-12 sm:py-16 lg:py-20 mx-auto max-w-4xl"> - <Headline - subtitle="A statically generated blog example with news, tutorials, resources and other interesting content related to AstroWind" - > - The Blog - </Headline> - <BlogList posts={page.data} /> - <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} /> - <!-- - <PostTags tags={allCategories} class="mb-2" title="Search by Categories:" isCategory /> - <PostTags tags={allTags} title="Search by Tags:" /> - --> - </section> -</Layout> diff --git a/src/pages/[...blog]/[category]/[...page].astro b/src/pages/[...blog]/[category]/[...page].astro deleted file mode 100644 index e1c4ff6..0000000 --- a/src/pages/[...blog]/[category]/[...page].astro +++ /dev/null @@ -1,37 +0,0 @@ ---- -import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; -import { blogCategoryRobots, getStaticPathsBlogCategory } from '~/utils/blog'; - -import Layout from '~/layouts/PageLayout.astro'; -import BlogList from '~/components/blog/List.astro'; -import Headline from '~/components/blog/Headline.astro'; -import Pagination from '~/components/blog/Pagination.astro'; - -export const prerender = true; - -export const getStaticPaths = (async ({ paginate }) => { - return await getStaticPathsBlogCategory({ paginate }); -}) satisfies GetStaticPaths; - -type Props = InferGetStaticPropsType<typeof getStaticPaths> & { category: Record<string, string> }; - -const { page, category } = Astro.props as Props; - -const currentPage = page.currentPage ?? 1; - -const metadata = { - title: `Category '${category.title}' ${currentPage > 1 ? ` — Page ${currentPage}` : ''}`, - robots: { - index: blogCategoryRobots?.index, - follow: blogCategoryRobots?.follow, - }, -}; ---- - -<Layout metadata={metadata}> - <section class="px-4 md:px-6 py-12 sm:py-16 lg:py-20 mx-auto max-w-4xl"> - <Headline>{category.title}</Headline> - <BlogList posts={page.data} /> - <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} /> - </section> -</Layout> diff --git a/src/pages/[...blog]/[tag]/[...page].astro b/src/pages/[...blog]/[tag]/[...page].astro deleted file mode 100644 index 86a767b..0000000 --- a/src/pages/[...blog]/[tag]/[...page].astro +++ /dev/null @@ -1,37 +0,0 @@ ---- -import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; -import { blogTagRobots, getStaticPathsBlogTag } from '~/utils/blog'; - -import Layout from '~/layouts/PageLayout.astro'; -import BlogList from '~/components/blog/List.astro'; -import Headline from '~/components/blog/Headline.astro'; -import Pagination from '~/components/blog/Pagination.astro'; - -export const prerender = true; - -export const getStaticPaths = (async ({ paginate }) => { - return await getStaticPathsBlogTag({ paginate }); -}) satisfies GetStaticPaths; - -type Props = InferGetStaticPropsType<typeof getStaticPaths>; - -const { page, tag } = Astro.props as Props; - -const currentPage = page.currentPage ?? 1; - -const metadata = { - title: `Posts by tag '${tag.title}'${currentPage > 1 ? ` — Page ${currentPage} ` : ''}`, - robots: { - index: blogTagRobots?.index, - follow: blogTagRobots?.follow, - }, -}; ---- - -<Layout metadata={metadata}> - <section class="px-4 md:px-6 py-12 sm:py-16 lg:py-20 mx-auto max-w-4xl"> - <Headline>Tag: {tag.title}</Headline> - <BlogList posts={page.data} /> - <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} /> - </section> -</Layout> diff --git a/src/pages/[...blog]/index.astro b/src/pages/[...blog]/index.astro deleted file mode 100644 index 421927c..0000000 --- a/src/pages/[...blog]/index.astro +++ /dev/null @@ -1,54 +0,0 @@ ---- -import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; - -import merge from 'lodash.merge'; -import type { ImageMetadata } from 'astro'; -import Layout from '~/layouts/PageLayout.astro'; -import SinglePost from '~/components/blog/SinglePost.astro'; -import ToBlogLink from '~/components/blog/ToBlogLink.astro'; - -import { getCanonical, getPermalink } from '~/utils/permalinks'; -import { getStaticPathsBlogPost, blogPostRobots } from '~/utils/blog'; -import { findImage } from '~/utils/images'; -import type { MetaData } from '~/types'; -import RelatedPosts from '~/components/blog/RelatedPosts.astro'; - -export const prerender = true; - -export const getStaticPaths = (async () => { - return await getStaticPathsBlogPost(); -}) satisfies GetStaticPaths; - -type Props = InferGetStaticPropsType<typeof getStaticPaths>; - -const { post } = Astro.props as Props; - -const url = getCanonical(getPermalink(post.permalink, 'post')); -const image = (await findImage(post.image)) as ImageMetadata | string | undefined; - -const metadata = merge( - { - title: post.title, - description: post.excerpt, - robots: { - index: blogPostRobots?.index, - follow: blogPostRobots?.follow, - }, - openGraph: { - type: 'article', - ...(image - ? { images: [{ url: image, width: (image as ImageMetadata)?.width, height: (image as ImageMetadata)?.height }] } - : {}), - }, - }, - { ...(post?.metadata ? { ...post.metadata, canonical: post.metadata?.canonical || url } : {}) } -) as MetaData; ---- - -<Layout metadata={metadata}> - <SinglePost post={{ ...post, image: image }} url={url}> - {post.Content ? <post.Content /> : <Fragment set:html={post.content || ''} />} - </SinglePost> - <ToBlogLink /> - <RelatedPosts post={post} /> -</Layout> |
